PHP 8 Basics by Gunnard Engebreth & Satej Kumar Sahu

PHP 8 Basics by Gunnard Engebreth & Satej Kumar Sahu

Author:Gunnard Engebreth & Satej Kumar Sahu
Language: eng
Format: epub
ISBN: 9781484280829
Publisher: Apress


7. Sessions and Cookies

Gunnard Engebreth1 and Satej Kumar Sahu2

(1)Madison, WI, USA

(2)Bangalore, India

In the previous chapters, you learned how to use arrays, one of the most versatile and useful elements in PHP, to store multiple values within a single variable. Let’s now imagine you need to store some information to be used across multiple web pages. You need to store some information on a local computer (client side) or store some information on a server (server side) for just a certain time using the web page. How would you do this? By using sessions and cookies.

The main difference between sessions and cookies is that cookies, as previously said, are used to store some user information on a local computer as client-side files while sessions are server-side files that store user information on a web server.

While cookies expire right after the specified lifetime you define, sessions end when you close the web browser or when you log out of the web page or program.

This chapter consists of the following sections:PHP Sessions



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.